home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 007a / cug317.zip / G3G4.H < prev    next >
Text File  |  1990-06-18  |  5KB  |  155 lines

  1. /*    $Id: g3g4.h 1.2 90/06/09 18:21:50 marking Exp $
  2.  *
  3.  NAME
  4.  *    g3g4.h -- definitions for decoding group 3 and group 4 images
  5.  *
  6.  USED WITH
  7.  *    builddec.c -- build decode tables
  8.  *    group 3 and group 4 encoding and decoding routines
  9.  *
  10.  DESCRIPTION
  11.  *    Common definitions for group 3 and group 4 utilities.
  12.  *
  13.  LEGAL
  14.  *    Copyright 1989, 1990 Michael P. Marking, Post Office Box 8039,
  15.  *    Scottsdale, Arizona 85252-8039. All rights reserved.
  16.  *
  17.  *    License is granted by the copyright holder to distribute and use this
  18.  *    code without payment of royalties or the necessity of notification as
  19.  *    long as this notice (all the text under "LEGAL") is included.
  20.  *
  21.  *    Reference: $Id: g3g4.h 1.2 90/06/09 18:21:50 marking Exp $
  22.  *
  23.  *    This program is offered without any warranty of any kind. It includes
  24.  *    no warranty of merchantability or fitness for any purpose. Testing and
  25.  *    suitability for any use are the sole responsibility of the user.
  26.  *
  27.  PORTABILITY
  28.  *
  29.  *    There is a non-portable use of "global" variables in this file,
  30.  *    about which a minority of compilers will justifiably complain. Certain
  31.  *    variables are declared here without extern keywords. Strictly
  32.  *    speaking, they should be declared extern in all but one module, but
  33.  *    that would require complication of this file. If it gets past your
  34.  *    compiler and linker, you can probably ignore it.
  35.  * 
  36.  HISTORY
  37.  *    $Log:    g3g4.h $
  38.  * Revision 1.2  90/06/09  18:21:50  marking
  39.  * clean up comments for release
  40.  * 
  41.  * Revision 1.1  89/06/30  17:00:00  marking
  42.  * Initial revision
  43.  * 
  44.  *
  45.  INFORMATION
  46.  *    Although there is no support offered with this program, the author will
  47.  *    endeavor to correct errors. Updates will also be made available from
  48.  *    time to time.
  49.  *
  50.  *    Contact: Michael P. Marking, Post Office Box 8039, Scottsdale, Arizona
  51.  *    85252-8039 USA. Replies are not guaranteed to be swift. Beginning
  52.  *    July 1990, e-mail may be sent to uunet!ipel!marking.
  53.  *
  54.  *    Also beginning in July 1990, this code will be archived at the
  55.  *    ipel!phoenix BBS in file g3g4.zoo. The 24-hour telephone number
  56.  *    for 300/1200/2400 is (602)274-0462. When logging in, specify user
  57.  *    "public", system "bbs", and password "public".
  58.  *
  59.  *    This code is also available from the C Users Group in volume 317.
  60.  */
  61.  
  62. #define WHITE 0
  63. #define BLACK 1
  64.  
  65. #define NULL_MODE 0
  66. #define PASS_MODE 1
  67. #define HORIZONTAL_MODE 2
  68. #define VERTICAL_V0_MODE 3
  69. #define VERTICAL_VR1_MODE 4
  70. #define VERTICAL_VR2_MODE 5
  71. #define VERTICAL_VR3_MODE 6
  72. #define VERTICAL_VL1_MODE 7
  73. #define VERTICAL_VL2_MODE 8
  74. #define VERTICAL_VL3_MODE 9
  75. #define EXT_MODE_UNCOMPRESSED 10
  76. #define ERROR_MODE 11
  77. #define ERROR_MODE_1 12
  78.  
  79. #define PASS_CODEWORD        0x1000
  80. #define HORIZONTAL_CODEWORD    0x2000
  81. #define VERTICAL_V0_CODEWORD    0x8000
  82. #define VERTICAL_VR1_CODEWORD    0x6000
  83. #define VERTICAL_VR2_CODEWORD    0x0C00
  84. #define VERTICAL_VR3_CODEWORD    0x0600
  85. #define VERTICAL_VL1_CODEWORD    0x4000
  86. #define VERTICAL_VL2_CODEWORD    0x0800
  87. #define VERTICAL_VL3_CODEWORD    0x0400
  88.  
  89. #define PASS_CODELEN        4
  90. #define HORIZONTAL_CODELEN    3
  91. #define VERTICAL_V0_CODELEN    1
  92. #define VERTICAL_VR1_CODELEN    3
  93. #define VERTICAL_VR2_CODELEN    6
  94. #define VERTICAL_VR3_CODELEN    7
  95. #define VERTICAL_VL1_CODELEN    3
  96. #define VERTICAL_VL2_CODELEN    6
  97. #define VERTICAL_VL3_CODELEN    7
  98.  
  99. #define RETURN_OK 0
  100. #define ERROR_NEXT_BYTE 1 /* the routine next_byte () unexpectedly returned
  101.   an error or end-of-file before the end of the image (EOFB) was reached */
  102. #define ERROR_UNSUPPORTED_EXTENSION 2
  103. #define ERROR_INVALID_CODEWORD 3
  104. #define ERROR_PROGRAM_LOGIC 4
  105.  
  106. #define EOL_CODE -1
  107. #define INVALID_CODE -2
  108.  
  109. #define MSB_FIRST 1
  110. #define LSB_FIRST 2
  111.  
  112. #define PAD_NONE 1
  113. #define PAD_BYTE 2
  114. #define PAD_NIBBLE 3
  115. #define PAD_ODD_NIBBLE 4
  116.  
  117. char  (*p_decode_black) (short);
  118. char  (*p_decode_new_row) (void);
  119. short (*p_decode_next_byte) (void);
  120. char  (*p_decode_white) (short);
  121.  
  122. char g3i_decode_T (void);
  123. char g3i_decode (void);
  124. char g3i_initialize (short, short);
  125. char g4i_decode (void);
  126. char g4i_initialize (short, short);
  127.  
  128. char (*p_encode_next_byte) (unsigned char);
  129.  
  130. char g3j_encode_black (short);
  131. char g3j_encode_white (short);
  132. char g3j_encode_new_row (void);
  133. char g3j_encode_pad (char);
  134. char g3j_initialize (short, short);
  135. char g4j_encode_black (short);
  136. char g4j_encode_white (short);
  137. char g4j_encode_EOFB (void);
  138. char g4j_encode_new_row (void);
  139. char g4j_initialize (short, short);
  140.  
  141. /* internal stuff */
  142.  
  143. void encode_word (unsigned short, short);
  144. void initialize_encode (void);
  145. short encode_position;
  146.  
  147. char output_fill_order, input_fill_order;
  148. unsigned char encode_buffer;
  149. unsigned char *decode_mask, *encode_mask, *encode_head_mask, *encode_tail_mask;
  150. short pending_black, pending_white;
  151.  
  152. char trace_flag;            /* for debug */
  153.  
  154. /*    end $RCSfile: g3g4.h $ */
  155.